const Controllers = require('../../controllers/Controller.js').controller;
Page({
  data: {
    id:"",
    pageNumber:1,
    lastPage:false,
    list:[]
  },
  onLoad: function (options) {
    if(options.id){
      this.setData({
        id:options.id,
        name:options.name
      })
    }

    this.getSellList()
    
  },
  onReachBottom(){
    this.getMore()
  },
  // 跳转用户详情
  toUserDetail(e){
    let id=e.currentTarget.dataset.id
    let accountId=e.currentTarget.dataset.accountid
    wx.navigateTo({
      url: '/pages/userStatistics/UserDeatils/UserDeatils?id='+id+"&accountId="+accountId
    })
  },

  getSellList(){
    let value={}
    value.pageNumber=this.data.pageNumber
    value.shopId=wx.getStorageSync('shopId')
    value.vipId=this.data.id
    Controllers.vipPayPage(value).then(res=>{
      this.setData({
        list:res.data.list,
        lastPage:res.data.lastPage
      })
    })
  },

  getMore(){
    if(this.data.lastPage==false){
      let value={}
      value.pageNumber=this.data.pageNumber
      value.shopId=wx.getStorageSync('shopId')
      value.vipId=this.data.id
      Controllers.vipPayPage().then(res=>{
        let list=this.data.list
        let list2=res.data.list
        let list3=list.concat(list2)
        this.setData({
          list:list3,
          lastPage:res.data.lastPage
        })
      })
    }
  }


})